import 'package:flutter/material.dart';
import 'package:homepad/models/nova_model.dart';
import 'package:homepad/styles.dart';
import 'package:homepad/views/item_service_card.dart';
import 'package:provider/provider.dart';

class HomeWidgetExternal extends StatelessWidget {
  const HomeWidgetExternal({super.key});

  @override
  Widget build(BuildContext context) {
    final MyStyles styles = Theme.of(context).extension<MyStyles>()!;
    var config = context.watch<NovaModel>().config;

    var node1 = config.getSecondaryNode(0);
    var node2 =  config.getSecondaryNode(1);

    return Container(
      height: 225,
      width: 225,
      decoration: ShapeDecoration(
        shape: RoundedRectangleBorder(borderRadius: styles.radius),
        image: const DecorationImage(
          fit: BoxFit.fill,
          image: AssetImage("assets/images/bg_home_widget_external.jpg"),
        ),
      ),
      child: Container(
        color: styles.overlay,
        padding: const EdgeInsets.all(10),
        child: Column(
          children: [
            if (node1 != null) ItemServiceCard(node: node1, cardType: ItemServiceCardType.medium),
            if (node1 != null) const SizedBox(height: 11),
            if (node2 != null) ItemServiceCard(node: node2, cardType: ItemServiceCardType.medium),
          ],
        )
        ),
    );
  }
}
